home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
regedit
/
regdemo.frm
< prev
next >
Wrap
Text File
|
1995-10-18
|
9KB
|
272 lines
VERSION 4.00
Begin VB.Form Form1
Caption = "Win32 RegDemo"
ClientHeight = 4980
ClientLeft = 1116
ClientTop = 1836
ClientWidth = 7584
Height = 5352
Icon = "REGDEMO.frx":0000
Left = 1068
LinkTopic = "Form1"
ScaleHeight = 4980
ScaleWidth = 7584
Top = 1512
Width = 7680
Begin VB.TextBox Text1
BackColor = &H8000000F&
Height = 288
Left = 180
Locked = -1 'True
TabIndex = 5
Text = "My Computer"
Top = 4560
Width = 7272
End
Begin ComctlLib.ListView ListView1
Height = 3672
Left = 3480
TabIndex = 4
Top = 300
Width = 3132
_Version = 65536
_ExtentX = 5525
_ExtentY = 6477
_StockProps = 205
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 1
Icons = ""
LabelEdit = 1
LabelWrap = 0 'False
SmallIcons = "ImageList1"
View = 3
End
Begin ComctlLib.ImageList ImageList1
Left = 7020
Top = 4380
_Version = 65536
_ExtentX = 804
_ExtentY = 804
_StockProps = 1
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = -2147483643
NumImages = 6
i1 = "REGDEMO.frx":030A
i2 = "REGDEMO.frx":04C1
i3 = "REGDEMO.frx":0678
i4 = "REGDEMO.frx":0B6F
i5 = "REGDEMO.frx":0D26
i6 = "REGDEMO.frx":0EDD
End
Begin ComctlLib.TreeView TreeView1
Height = 3672
Left = 180
TabIndex = 3
Top = 300
Width = 3192
_Version = 65536
_ExtentX = 5630
_ExtentY = 6477
_StockProps = 196
Appearance = 1
BorderStyle = 1
ImageList = "ImageList1"
Indentation = 2
LabelEdit = 1
LineStyle = 1
PathSeparator = "\"
Sorted = -1 'True
Style = 7
End
Begin VB.Label Label4
Appearance = 0 'Flat
Caption = "Double-Click a Value to edit it"
ForeColor = &H80000008&
Height = 252
Left = 4020
TabIndex = 2
Top = 4200
Width = 3312
End
Begin VB.Label Label3
Appearance = 0 'Flat
Caption = "Double-Click a Key to expand it"
ForeColor = &H80000008&
Height = 252
Left = 120
TabIndex = 1
Top = 4200
Width = 3612
End
Begin VB.Label Label1
Appearance = 0 'Flat
Caption = "Key Name"
ForeColor = &H80000008&
Height = 192
Left = 60
TabIndex = 0
Top = 60
Width = 1272
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Dim OsVers As OsVersionInfo
Private Sub Form_Load()
Width = 600 * Screen.TwipsPerPixelX
CenterForm Me
Dim nodX As Node
Dim ClmHdr As ColumnHeader
'-----------------------------------------------------
' add columns to listview control
'-----------------------------------------------------
Set ClmHdr = ListView1.ColumnHeaders.Add()
ClmHdr.Text = "Name"
ClmHdr.Width = ListView1.Width / 3
Set ClmHdr = Me.ListView1.ColumnHeaders.Add()
ClmHdr.Text = "Data"
ClmHdr.Width = 3 * ListView1.Width / 2
'-----------------------------------------------------
'First we find out what Windows is running. There are a
'couple of registry keys in Win95 that are not present
'in Windows NT
'-----------------------------------------------------
OsVers.dwVersionInfoSize = 148&
lTempLong = GetVersionEx(OsVers)
Select Case OsVers.dwPlatform
Case VER_PLATFORM_WIN32_NT
iWinVers = WinNt
Case VER_PLATFORM_WIN32_WINDOWS
iWinVers = Win32
Case Else 'Shouldn't happen
MsgBox "This program is intended only for use with 32-bit Windows versions."
Unload Form1
End Select
'-----------------------------------------------------
'Start the TreeView with a toplevel key
'-----------------------------------------------------
Set nodX = TreeView1.Nodes.Add(, , "main", "My Computer", 3)
'-----------------------------------------------------
'Put in Public main keys
'-----------------------------------------------------
Set nodX = TreeView1.Nodes.Add("main", tvwChild, "HKEY_CLASSES_ROOT", "HKEY_CLASSES_ROOT", 1)
nodX.EnsureVisible 'Forces the tree open to this level
nodX.ExpandedImage = 2
nodX.SelectedImage = 2
RegEnumKeys nodX, False 'Enumerate a single rgeSubKey, to put a + on the key
Set nodX = TreeView1.Nodes.Add("main", tvwChild, "HKEY_CURRENT_USER", "HKEY_CURRENT_USER", 1)
nodX.ExpandedImage = 2
nodX.SelectedImage = 2
RegEnumKeys nodX, False
Set nodX = TreeView1.Nodes.Add("main", tvwChild, "HKEY_LOCAL_MACHINE", "HKEY_LOCAL_MACHINE", 1)
nodX.ExpandedImage = 2
nodX.SelectedImage = 2
RegEnumKeys nodX, False
Set nodX = TreeView1.Nodes.Add("main", tvwChild, "HKEY_USERS", "HKEY_USERS", 1)
nodX.ExpandedImage = 2
nodX.SelectedImage = 2
RegEnumKeys nodX, False
'-----------------------------------------------------
'Put in version-specific main keys
'HKEY_PERFORMANCE_DATA does not respond in a normal fashion
'to key queries. Note it does not appear in REGEDT32.
'If iWinVers = WinNT Then
'treeview1.AddItem "HKEY_PERFORMANCE_DATA"
'End If
'-----------------------------------------------------
If iWinVers = Win32 Then
Set nodX = TreeView1.Nodes.Add("main", tvwChild, "HKEY_CURRENT_CONFIG", "HKEY_CURRENT_CONFIG", 1)
nodX.ExpandedImage = 2
nodX.SelectedImage = 2
RegEnumKeys nodX, False
Set nodX = TreeView1.Nodes.Add("main", tvwChild, "HKEY_DYN_DATA", "HKEY_DYN_DATA", 1)
nodX.ExpandedImage = 2
nodX.SelectedImage = 2
RegEnumKeys nodX, False
End If
'-----------------------------------------------------
'Setup hourglass cursor
'-----------------------------------------------------
iWaitCursor = LoadCursor(0, IDC_WAIT)
End Sub
Private Sub Form_Resize()
'-----------------------------------------------------
'Resize controls when the user resizes the form.
'-----------------------------------------------------
On Error GoTo ReSizeError
TreeView1.Move 60, TreeView1.Top, (ScaleWidth / 2) - 300, ScaleHeight - 1200
ListView1.Move TreeView1.Width + 90, TreeView1.Top, TreeView1.Width + 480, TreeView1.Height
Label1.Left = TreeView1.Left + 60
Label3.Move 90, TreeView1.Top + TreeView1.Height + 150
Label4.Move ListView1.Left + 90, Label3.Top
Text1.Move TreeView1.Left, Label3.Top + Label3.Height + 150, ScaleWidth - 2 * TreeView1.Left
Exit Sub
ReSizeError:
Exit Sub
End Sub
Private Sub listview1_DblClick()
' if nothing selected get out
If Not (ListView1.SelectedItem Is Nothing) Then
'----------------------------------------------------------
'Call EditRegValue to load